<template>
	<view>
		<view class="content">
			<view class="bt">反馈问题：</view>
			<view class="textarea">{{ content }}</view>
			<view class="bt btb">我的回复：</view>
			<textarea class="hf" v-model="backcontent" auto-height placeholder="请输入回复"
				:disabled="status=='0'?false:true" maxlength="500" />
			<view bindtap="xyTJ" class="tjbtn" v-if="status=='0'">提交</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				status: '0',
				backcontent: '',
				content: ''
			};
		},
		onLoad(options) {
			this.id = options.id
			this.getData(options.id);
		},
		methods: {
			xyTJ() {
				if (!this.backcontent) return uni.showToast({
					title: '请输入反馈内容',
					icon: 'none',
					duration: 2000
				});
				this.$app.ajax({
					data: {
						userId: uni.getStorageSync('userId'),
						param: {
							backContent: this.backcontent,
							id: this.id
						}
					},
					api: this.$api.feedBack()
				}).then(res => {
					if (res.errorCode != '000000') return;
					uni.showToast({
						title: '提交成功',
						icon: 'success',
						duration: 2000
					});
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						});
					}, 1000);
				});
			},
			getData(id) {
				this.$app.ajax({
					data: {
						param: {
							id
						}
					},
					api: this.$api.feedBackDetails()
				}).then(res => {
					if (res.errorCode != '000000') return;
					this.content = res.record.content,
						this.backcontent = res.record.status == '1' ? res.record.backContent : '',
						this.status = res.record.status
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.bt {
		font-size: 30rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #222222;
		margin-bottom: 30rpx;
	}

	.btb {
		color: #4167c1;
	}

	.content {
		padding: 30rpx 30rpx 130rpx;
		box-sizing: border-box;
	}

	textarea,
	.textarea {
		background: rgba(65, 103, 193, 0.06);
		padding: 30rpx;
		/* box-sizing: border-box; */
		box-sizing: content-box;
		font-size: 28rpx;
		margin-bottom: 45rpx;
		width: 630rpx;
		border-radius: 8rpx;
		border: none;
		height: auto;
	}

	textarea.hf {
		background: #f7f7f7;
		min-height: 200rpx;
	}

	.tjbtn {
		background: #4167c1;
		font-size: 30rpx;
		color: #ffffff;
		text-align: center;
		line-height: 88rpx;
		border-radius: 50rpx;
		margin-top: 30rpx;
		position: fixed;
		left: 30rpx;
		font-weight: 500;
		bottom: 30rpx;
		width: 690rpx;
	}
</style>